#include "focusevent.h"

using namespace gui;

QEvent::Type FocusEvent::customEventType = QEvent::None;

FocusEvent::FocusEvent(bool focusIn) : QEvent(FocusEvent::type()),
    m_focusIn(focusIn)
{
    setAccepted(false);
}

FocusEvent::~FocusEvent()
{

}

bool FocusEvent::focusIn() const
{
    return m_focusIn;
}

bool FocusEvent::focusOut() const
{
    return !m_focusIn;
}

QEvent::Type FocusEvent::type()
{
    if (customEventType == QEvent::None)
    {
        int generatedType = QEvent::registerEventType();
        customEventType = static_cast<QEvent::Type>(generatedType);
    }
    return customEventType;
}
